package com.wonderful.mall.order;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * 1.引入rabbitMQ
 *         <dependency>
 *             <groupId>org.springframework.boot</groupId>
 *             <artifactId>spring-boot-starter-amqp</artifactId>
 *         </dependency>
 * 2.给容器中自动配置RabbitTemplate、AmqpAdmin、
 * ConfigurationProperties(
 *     prefix = "spring.rabbitmq"
 * )
 * spring.rabbitmq.host=192.168.56.10
 * spring.rabbitmq.port=5672
 * spring.rabbitmq.virtual-host=/
 * 3.EnableRabbit
 * 监听消息RabbitListener
 * <p>
 *  3.本地事务失效：同一个对象内事务方法互调默认失效，原因 绕过了代理对象，事务使用代理对象来控制
 *  解决：使用代理对象来调用事务方法
 *   1）、引入aop-starter ；aspectj
 *   2）、开启aspectj动态代理 @EnableAspectjAutoProxy  即使没有接口也可以创建动态代理
 *   T t = (T)AopContext.currentProxy();
 *   <p></p>
 *   Seata 下载服务器软件包
 *   启动seata服务器
 *   registry-config:注册中心配置
 */
@EnableRabbit
@EnableAspectJAutoProxy(exposeProxy = true)//对外暴露代理对象
@EnableRedisHttpSession
@EnableDiscoveryClient
@SpringBootApplication
@EnableFeignClients
public class MallOrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(MallOrderApplication.class, args);
    }

}
